<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Users_model extends CI_Model {

    function __construct() {
        parent::__construct();
        $this->load->helper(array('form', 'html', 'language', 'url'));
    }

    function getAllUsers(){
        $query = $this->db->get('users');
        return $query->result();
    }

    function save($data, $user_id = null){
        if (!empty($user_id)){
            $this->db->where('id', $user_id);
            if (!$this->db->update('users', $data)){
                return false;
            }
        }
        return true;
    }
}